home *** CD-ROM | disk | FTP | other *** search
/ Hackers Underworld 2: Forbidden Knowledge / Hackers Underworld 2: Forbidden Knowledge.iso / VIRUS / RT0.C < prev    next >
Text File  |  1994-07-17  |  2KB  |  85 lines

  1. #include <stdio.h>
  2. #include <dos.h>
  3. #include <conio.h>
  4. #include <process.h>
  5. #include <stdlib.h>
  6. #include <alloc.h>
  7. #include <io.h>
  8. #include <bios.h>
  9.  
  10.  /*
  11.   * This program will restore your hard disk's track zero data.  It
  12.   * is specifically designed to provide a remedy against the the so-called
  13.   * "Columbus day" virus.
  14.   *
  15.   * This program may be freely copied.
  16.   *
  17.   * Author:  John Clason, KZ1O [70441,2456]
  18.   *
  19.   */
  20.  
  21. void error(int code)
  22. {
  23.     switch (code) {
  24.     case 1:
  25.      fprintf(stderr, "Unable to allocate enough memory\n");
  26.     break;
  27.     case 2:
  28.     fprintf(stderr, "Unable to open file A:TRACK.000\n");
  29.     break;
  30.     case 4:
  31.     fprintf(stderr, "Unable to complete reading floppy disk\n");
  32.     break;
  33.     default:
  34.     fprintf(stderr, "Unknown error occurred: %d\n", code);
  35.     break;
  36.     }
  37.     exit(code);
  38. }
  39.  
  40. int main(void)
  41. {
  42.     char *buffer;
  43.  
  44.     unsigned cx, dx;
  45.     int maxhead, maxsectors, h;
  46.     int fd;
  47.     unsigned bytes;
  48.  
  49.     printf("Restoring hard disk track zero from A:TRACK.000\n"
  50.     "More public domain software from John Clason [70441,2456]\n");
  51.  
  52.     _DL = 0x80;
  53.     _AH = 8;
  54.     geninterrupt(0x13);        /* get params */
  55.  
  56.     cx = _CX;
  57.     dx = _DX;
  58.  
  59.     maxhead = dx >> 8;
  60.     maxsectors = cx & 0x3f;
  61.  
  62. #ifndef ALLCYLINDER
  63.     maxhead=0;
  64. #endif
  65.  
  66.     buffer = calloc(bytes = (maxsectors * 512), 1);
  67.     if (buffer == NULL)
  68.     error(1);
  69.  
  70.     fd = _open("a:track.000", 0);
  71.     if (fd < 0)
  72.     error(2);
  73.  
  74.     for (h = 0; h <= maxhead; h++) {
  75.     if (_read(fd, buffer, bytes) != bytes)
  76.         error(4);
  77.     biosdisk(3, 0x80, h, 0, 1, maxsectors, buffer);
  78.     }
  79.     close(fd);
  80.     return 0;
  81. }
  82. 
  83.  
  84. Downloaded From P-80 International Information Systems 304-744-2253
  85.